Class NewsActiveSearchRepositoryTest

java.lang.Object
com.fsf.news.repository.NewsActiveSearchRepositoryTest

@ExtendWith(org.mockito.junit.jupiter.MockitoExtension.class) class NewsActiveSearchRepositoryTest extends Object
Unit tests for the NewsActiveSearchRepository class.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) com.fsf.news.model.form.NewsForm
     
    (package private) com.fsf.news.repository.NewsActiveSearchRepository
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) void
    Tests that the clearSession method removes all active searches for a non-empty session.
    (package private) void
    Tests that the clearSession method works correctly for an already empty session.
    (package private) void
    Tests that deleteById removes the correct search.
    (package private) void
    Tests that deleteById does not remove searches from other sessions.
    (package private) void
    Tests that deleteById does not fail for non-existent searches.
    (package private) void
    Tests that the findAll method returns the expected active searches when available.
    (package private) void
    Tests that the findAll method returns the expected active searches when the maximum capacity is exceeded.
    (package private) void
    Tests that the findAll method returns an empty list when searching for active searches in a different session.
    (package private) void
    Tests that the findAll method returns an empty list when no active searches are available.
    (package private) void
    Tests that the findAll method returns the expected active searches when the maximum capacity is reached.
    (package private) void
    Tests that the findById method returns the expected active search when available.
    (package private) void
    Tests that the findById method returns an empty optional when searching for an active search in a different session.
    (package private) void
    Tests that the findById method returns an empty optional when no active search is available.
    (package private) void
    Tests that the save method adds an active search and returns the expected active search.
    (package private) void
    Tests that the save method replaces a previously saved active search and returns the expected active search.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • repository

      @InjectMocks com.fsf.news.repository.NewsActiveSearchRepository repository
    • form

      @Mock com.fsf.news.model.form.NewsForm form
  • Constructor Details

    • NewsActiveSearchRepositoryTest

      NewsActiveSearchRepositoryTest()
  • Method Details

    • testFindByIdEmpty

      @Test void testFindByIdEmpty()
      Tests that the findById method returns an empty optional when no active search is available.
    • testFindById

      @Test void testFindById()
      Tests that the findById method returns the expected active search when available.
    • testFindByIdDifferentSession

      @Test void testFindByIdDifferentSession()
      Tests that the findById method returns an empty optional when searching for an active search in a different session.
    • testDeleteByIdEmpty

      @Test void testDeleteByIdEmpty()
      Tests that deleteById does not fail for non-existent searches.
    • testDeleteById

      @Test void testDeleteById()
      Tests that deleteById removes the correct search.
    • testDeleteByIdDifferentSession

      @Test void testDeleteByIdDifferentSession()
      Tests that deleteById does not remove searches from other sessions.
    • testFindAllEmpty

      @Test void testFindAllEmpty()
      Tests that the findAll method returns an empty list when no active searches are available.
    • testFindAll

      @Test void testFindAll()
      Tests that the findAll method returns the expected active searches when available.
    • testFindAllDifferentSession

      @Test void testFindAllDifferentSession()
      Tests that the findAll method returns an empty list when searching for active searches in a different session.
    • testFindAllMaxCapacity

      @Test void testFindAllMaxCapacity()
      Tests that the findAll method returns the expected active searches when the maximum capacity is reached.
    • testFindAllBeyondCapacity

      @Test void testFindAllBeyondCapacity()
      Tests that the findAll method returns the expected active searches when the maximum capacity is exceeded.
    • testSave

      @Test void testSave()
      Tests that the save method adds an active search and returns the expected active search.
    • testSaveReplaceExisting

      @Test void testSaveReplaceExisting()
      Tests that the save method replaces a previously saved active search and returns the expected active search.
    • testClearSession

      @Test void testClearSession()
      Tests that the clearSession method removes all active searches for a non-empty session.
    • testClearSessionEmpty

      @Test void testClearSessionEmpty()
      Tests that the clearSession method works correctly for an already empty session.